package ca.jsbr.canvaswar.games.map 
{
	import ca.jsbr.as2js_lib.display.canvas.view.SpriteView;
	import ca.jsbr.as2js_lib.utils.geom.Point;
	import ca.jsbr.as2js_lib.utils.grid.ITile;
	import ca.jsbr.canvaswar.games.unit.Unit;
	/**
	 * ...
	 * @author 
	 */
	public class Tile implements ITile
	{
		public var unit:Unit;
		private var _asset:SpriteView;
		private var _position:Point;
		private var _heuristic:Number;
		private var _cost:int;
		private var _obstacle:Boolean;
		public var moveCost:int=1;
		public var overlay:SpriteView;
		
		public function Tile(x:int, y:int, asset:SpriteView) 
		{
			_position = new Point(x, y);
			_asset = asset;
		}
	
		
		public function get asset():SpriteView 
		{
			return _asset;
		}
		
		public function set asset(value:SpriteView):void 
		{
			_asset = value;
		}
		
		public function destroy():void 
		{
			if(unit)
				unit.tile = null;
		}
		
		
		public function get position():Point 
		{
			return _position;
		}
		
		public function set position(value:Point):void 
		{
			_position = value;
		}
		
		public function get heuristic():Number 
		{
			return _heuristic;
		}
		
		public function set heuristic(value:Number):void 
		{
			_heuristic = value;
		}
		
		public function get cost():int 
		{
			return _cost;
		}
		
		public function set cost(value:int):void 
		{
			_cost = value;
		}
		
		public function get obstacle():Boolean 
		{
			return _obstacle;
		}
		
		public function set obstacle(value:Boolean):void 
		{
			_obstacle = value;
		}
		
	}

}